<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:68:"D:\WWW\ZL\blog\public/../application/admin\view\share\shareList.html";i:1564449309;}*/ ?>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <LINK rel="Bookmark" href="/favicon.ico" >
    <LINK rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>

    <![endif]-->
    <link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC_ADMIN__/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>友情链接列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>分享管理 <span class="c-gray en">&gt;</span> 分享列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <form method="get">
        <div class="text-c">
            <input type="text" class="input-text" style="width:250px" placeholder="输入链接地址" id="" name="git_url" value="<?php echo $display['link_name']?>">
            <button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"> <a href="javascript:;" onclick="admin_add('添加友情链接','<?php echo url('Share/shareAdd'); ?>','800','500')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加分享链接</a></span>  </div>
        <table class="table table-border table-bordered table-bg">
            <thead>
            <tr>
                <th scope="col" colspan="10">分享列表</th>
            </tr>
            <tr class="text-c">
                <th width="25"><input type="checkbox" name="" value=""></th>
                <th width="40">ID</th>
                <th>链接地址</th>
                <th width="130">加入时间</th>
                <th width="100">操作</th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($result as $v){?>
            <tr class="text-c">
                <td><input type="checkbox" value="1" name=""></td>
                <td><?php echo $v['id']?></td>
                <td><?php echo $v['git_url']?></td>
                <td><?php echo date('Y-m-d H:i:s',$v['create_time'])?></td>
                <td class="td-manage">
                    <a title="编辑" href="javascript:;" onclick="admin_edit('分享编辑','<?php echo url('Share/shareSave',['id'=>$v['id']])?>','800','500')" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a>
                    <a title="删除" href="javascript:;" onclick="admin_del(this,<?= $v['id']?>)" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>

                </td>
            </tr>
            <?php }if(empty($result)){?>
            <tr class="text-l"><td colspan="10">没有找到匹配的记录</td></tr>
            <?php }?>
            </tbody>
        </table>
        <span class="r pages mt-10"> <?php echo $result->render(); ?></span>
    </form>
</div>

<script type="text/javascript" src="__STATIC_ADMIN__/js/jquery.min.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/layer.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/H-ui.min.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/H-ui.admin.js"></script>

<script type="text/javascript" src="__STATIC_ADMIN__/js/jquery.validate.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/validate-methods.js"></script>
<script type="text/javascript" src="__STATIC_ADMIN__/js/messages_zh.js"></script>
<script type="text/javascript">
    /*
     参数解释：
     title	标题
     url		请求的url
     id		需要操作的数据id
     w		弹出层宽度（缺省调默认值）
     h		弹出层高度（缺省调默认值）
     */
    /*管理员-增加*/
    function admin_add(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*管理员-增加*/
    function change_password(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*管理员-删除*/
    function admin_del(obj,id){
        layer.confirm('确认要删除吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……
            $.ajax({
                type: 'get',
                url : "<?= url('Share/shareDelete')?>",
                data: {'id':id},
                success:function(data){
                    var data = jQuery.parseJSON(data);
                    if(data.code == 10000){
                        $(obj).parents("tr").remove();
                        layer.msg('已删除!',{icon:1,time:1000});
                    }else {
                        layer.msg(data.msg,{icon:5,time:1000});
                    }
                }
            });

        });
    }
    /*管理员-编辑*/
    function admin_edit(title,url,w,h){
        layer_show(title,url,w,h);
    }
    /*管理员状态改变*/
    function changeAdminStatus(obj,id,status){
        var str = status==1 ? '禁用':'启用';
        var str1= status==2 ? '禁用':'启用';
        var icon= status==1 ? '&#xe615;':'&#xe631;';
        var style=status==1 ? 'label radius':'label label-success radius';
        var face= status==1 ? 7:1;
        layer.confirm('确认要'+str+'吗？',function(index){
            //此处请求后台程序，下方是成功后的前台处理……
            $.ajax({
                type:'get',
                url :"<?php echo url('Link/changeAdminStatus')?>",
                data:{'id':id,'status':status},
                success:function(data){
                    if(typeof data === 'string'){
                        data = jQuery.parseJSON(data);
                    }
                    if(data.code==10000){
                        $(obj).parents("tr").find(".td-manage").prepend('<a onClick="changeAdminStatus(this,'+id+','+data.data.status+')" href="javascript:;" title='+str1+' style="text-decoration:none"><i class="Hui-iconfont">'+icon+'</i></a>');
                        $(obj).parents("tr").find(".td-status").html('<span class="'+style+'">已'+str+'</span>');
                        $(obj).remove();
                        layer.msg('已'+str+'!',{icon:face,time:1000});
                    }else {
                        layer.msg(data.msg,{icon:5,time:1000});
                    }
                }
            })

        });
    }

</script>
</body>
</html>